package com.rd.student.jike.class1.guojiabao.Day0728;

import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;

public class RandomText01 {
    public static void main(String[] args) throws Exception{
        System.out.println("请输入要抽取学生的个数");
        Scanner sc = new Scanner(System.in);
        new Random(sc.nextInt());

    }
    public static String[] Random(int a){
        String str = "郑成祥、王博、孙文卓、郑睿娴、" +
                "王高博、李春泉、张睿、王星凯、" +
                "柏云耀、高艺铭、周子贺、杜航、" +
                "高晨曦、张思韬、孙昊、方周、" +
                "郭佳宝、姜万里、李宏鸣、薛志鑫、" +
                "王海鑫、夏银银、吴俊豪、王向阳、" +
                "徐铭泽、张世煊、才雨鑫、孙国伟、" +
                "秦嘉林、王岩博、石睿、杜雨坤、黄奕鸣、" +
                "金洪宇、李鑫、王宇芳、苏岩、";
        ArrayList<String> arrayList = new ArrayList<>();
        String str1 = "";
        char[] chars = str.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            if (chars[i] == '、') {
                arrayList.add(str1);
                str1 = "";
                continue;
            }
            str1 = str1 + chars[i];
        }
//
        int[] index = new int[a];
        for (int i = 0; i < a; i++) {

            if (i == 0) {
                index[i] = new Random().nextInt(38);
            }else {
                for (int j = 0; j < index.length-1; j++) {
                    int b = new Random().nextInt(38);
                    if(b != index[j]){
                        index[i] = b;
                    }

                }
            }
        }
        String[] name = new String[index.length];
        for (int i = 0; i < index.length; i++) {
            System.out.println((String) arrayList.get(i));
            name[i] = (String) arrayList.get(i);
        }
        return name;
    }
}
